<template>
    <h3>修改借款表</h3>
    <table border="1">
        <tr>
           <td>借款款项名称</td>
           <td>
            <input type="text" v-model="info.JName" placeholder="请输入借款款项名称">
           </td>
        </tr>
        <tr>
           <td>借款最高金额</td>
           <td>
            <input type="text"  v-model="info.JMaxPrice" placeholder="请输入借款最高金额">
           </td>
        </tr>
        <tr>
           <td>借款最高年限</td>
           <td>
            <input type="text"  v-model="info.JMaxYear" placeholder="请输入借款最高年限">
           </td>
        </tr>
        <tr>
           <td>利息</td>
           <td>
           <select>
            <option value="--请选择--">请选择</option>
                <option value="一年2.1">一年2.1</option>
                <option value="两年2.4">两年2.4</option>
                <option value="三年3.6">三年3.6</option>
            </select>
           </td>
        </tr>
        <tr>
           <td>借款款项简介</td>
           <td>
            <input type="text" v-model="info.JAbstract" placeholder="请输入借款款项简介">
           </td>
        </tr>
       
        <tr>
           <td colspan="2">
            <input type="button" value="修改" @click="AddJMoney">
           </td>
           
        </tr>
    </table>
</template>

<script setup lang="ts">
    import {ref} from 'vue';
    import axios from 'axios';


    const info = ref({
        JName:'',
        JMaxPrice:'',
        JMaxYear:'',
        JAbstract:''
    })
//添加
    const AddJMoney = ()=>{


        axios.post('http://localhost:4743/api/API/Add',{
            
            JName:info.value.JName,
            JMaxPrice:info.value.JMaxPrice,
            JMaxYear:info.value.JMaxYear,
            JAbstract:info.value.JAbstract
        })
        .then(res=>{
            if(res.data>0){
                alert("添加成功")
                location.href = '/ShowJMoney'
            }
            else{
                alert("添加失败")
            }
        })
    }
</script>